# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=breeze
pkgname=('breeze' 'breeze-kde4')
pkgver=5.10.5
pkgrel=1
arch=('i686' 'x86_64')
url='https://www.kde.org/workspaces/plasmadesktop/'
license=('LGPL')
makedepends=('extra-cmake-modules' 'frameworkintegration' 'kdelibs'
             'automoc4' 'kdecoration' 'kcmutils' 'plasma-framework' 'python')
source=("https://download.kde.org/stable/plasma/${pkgver}/$pkgbase-$pkgver.tar.xz"{,.sig})
sha256sums=('1ba46701e13f983b97c7e7dd01da8637a2f17ee818928064f4729895ac1dac66'
            'SKIP')
validpgpkeys=('2D1D5B0588357787DE9EE225EC94D18F7F05997E'  # Jonathan Riddell
              '348C8651206633FD983A8FC4DEACEA00075E1D76'  # KDE Neon
              'D07BD8662C56CB291B316EB2F5675605C74E02CF') # David Edmundson

prepare() {
  mkdir -p build{,-kde4}
}

build() {
  cd build
  cmake ../${pkgbase}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DKDE_INSTALL_LIBDIR=lib \
    -DBUILD_TESTING=OFF
  make

  cd ../build-kde4
  cmake ../${pkgbase}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_KDE4=ON \
    -DBUILD_TESTING=OFF
  make
}

package_breeze() {
  depends=('frameworkintegration' 'kdecoration' 'breeze-icons' 'kwayland')
  pkgdesc='Artwork, styles and assets for the Breeze visual style for the Plasma Desktop'
  optdepends=('breeze-kde4: Breeze widget style for KDE4 applications'
		'breeze-gtk: Breeze widget style for GTK applications'
		'kcmutils: for breeze-settings')
  groups=('plasma')

  cd build
  make DESTDIR="$pkgdir" install
}

package_breeze-kde4() {
  pkgdesc='Breeze widget style for KDE4 applications'
  depends=('kdelibs')

  cd build-kde4
  make DESTDIR="$pkgdir" install

  # needed for pure Qt4 apps
  install -d "$pkgdir"/usr/lib/qt4/plugins/styles
  ln -s /usr/lib/kde4/plugins/styles/breeze.so "$pkgdir"/usr/lib/qt4/plugins/styles
}
